package com.hsc.yalebao.weight;

import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.text.TextPaint;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.PopupWindow.OnDismissListener;
import android.widget.ScrollView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.hsc.yalebao.adapter.NewOddsListViewAdapter;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.PlayroomRuleinfoBaseBean;
import com.hsc.yalebao.model.PlayroomRuleinfoBean;
import com.hsc.yalebao.tabMine.BackRuleActivity;
import com.zhy.http.okhttp.callback.StringCallback;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import okhttp3.Call;

public class NewMyOddsPopuWindow extends PopupWindow
{
  private String TAG = "NewMyOddsPopuWindow";
  public NewOddsListViewAdapter adapter;
  private MyDialogListener cancleListener = null;
  private Context context;
  private MyDialogListener defaultListener = null;
  private float heightProportion = 0.9F;
  private LinearLayout layout_body;
  private SelfListView lv_teshu;
  private MyDialogListener okListener = null;
  private PopupWindow popwindow;
  public ArrayList<PlayroomRuleinfoBaseBean> result = new ArrayList();
  String roomId;
  int room_level;
  private ScrollView sc_peilv_shuoming;
  private TextView tv_close;
  private TextView tv_look_backrule;
  private TextView tv_shuoming;
  View view;
  private float widthProportion = 0.9F;

  public NewMyOddsPopuWindow(final Context paramContext, String paramString, int paramInt)
  {
    super(paramContext);
    this.context = paramContext;
    this.roomId = paramString;
    this.room_level = paramInt;
    this.view = LayoutInflater.from(paramContext).inflate(2130903157, null);
    if (this.popwindow == null)
      this.popwindow = new PopupWindow(this.view, -2, -2, true);
    this.layout_body = ((LinearLayout)this.view.findViewById(2131100063));
    this.sc_peilv_shuoming = ((ScrollView)this.view.findViewById(2131100180));
    this.tv_close = ((TextView)this.view.findViewById(2131100179));
    this.tv_shuoming = ((TextView)this.view.findViewById(2131100183));
    this.tv_look_backrule = ((TextView)this.view.findViewById(2131100182));
    this.tv_look_backrule.setVisibility(0);
    this.tv_look_backrule.getPaint().setFlags(8);
    this.tv_look_backrule.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        paramContext.startActivity(new Intent(paramContext, BackRuleActivity.class));
      }
    });
    this.lv_teshu = ((SelfListView)this.view.findViewById(2131100181));
    if (this.adapter == null)
      this.adapter = new NewOddsListViewAdapter(paramContext, this.result);
    this.lv_teshu.setAdapter(this.adapter);
    this.tv_close.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        NewMyOddsPopuWindow.this.popwindow.dismiss();
      }
    });
    setDialogSize(this.widthProportion, this.heightProportion, 17);
  }

  private void getroomRuleInfo()
  {
    HashMap localHashMap = new HashMap();
    localHashMap.put("roomid", this.roomId);
    LogUtils.i(this.TAG, "roomid:" + this.roomId);
    LogUtils.i(this.TAG, "URL:" + AppConstants.URL_GET_GETROOMRULEINFO);
    MainActivity.mainActivity.showLoadingDialog();
    RequestNet.get(this.context, AppConstants.URL_GET_GETROOMRULEINFO, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        MainActivity.mainActivity.dismissLoadingDialog();
        LogUtils.e(NewMyOddsPopuWindow.this.TAG, "获取失败,getPlaytList-result:" + paramAnonymousException);
      }

      public void onResponse(String paramAnonymousString)
      {
        MainActivity.mainActivity.dismissLoadingDialog();
        LogUtils.d(NewMyOddsPopuWindow.this.TAG, "result:" + paramAnonymousString);
        if ((paramAnonymousString == null) || ("".equals(paramAnonymousString)))
          LogUtils.e(NewMyOddsPopuWindow.this.TAG, "result:" + paramAnonymousString);
        PlayroomRuleinfoBean localPlayroomRuleinfoBean;
        do
        {
          return;
          Gson localGson = new Gson();
          try
          {
            localPlayroomRuleinfoBean = (PlayroomRuleinfoBean)localGson.fromJson(paramAnonymousString, PlayroomRuleinfoBean.class);
            if (localPlayroomRuleinfoBean == null)
            {
              LogUtils.e(NewMyOddsPopuWindow.this.TAG, "getCurrSecond-issueTimeBean == null，获取失败");
              return;
            }
          }
          catch (Exception localException)
          {
            while (true)
            {
              localException.printStackTrace();
              localPlayroomRuleinfoBean = null;
            }
            String str = localPlayroomRuleinfoBean.getDescription();
            NewMyOddsPopuWindow.this.tv_shuoming.setText(str);
            LogUtils.e(NewMyOddsPopuWindow.this.TAG, "ruleBean.getDescription()：" + localPlayroomRuleinfoBean.getDescription());
            if (localPlayroomRuleinfoBean.getFlag() == 1)
            {
              NewMyOddsPopuWindow.this.result = localPlayroomRuleinfoBean.getResult();
              NewMyOddsPopuWindow.this.setDataTe(NewMyOddsPopuWindow.this.result);
              return;
            }
            if (localPlayroomRuleinfoBean.getFlag() == -2)
            {
              MainActivity.mainActivity.showOffLineDialog();
              return;
            }
            if (localPlayroomRuleinfoBean.getFlag() == -3)
            {
              MainActivity.mainActivity.showFengjinDialog();
              return;
            }
          }
        }
        while (localPlayroomRuleinfoBean.getFlag() != -4);
        ActivityStack.getInstance().backToMain(MainActivity.class, NewMyOddsPopuWindow.this.context);
      }
    });
  }

  public void setDataTe(ArrayList<PlayroomRuleinfoBaseBean> paramArrayList)
  {
    this.result = paramArrayList;
    if (this.adapter != null)
    {
      this.adapter.setData(paramArrayList);
      this.adapter.notifyDataSetChanged();
      LogUtils.i(this.TAG, "dataTe.size():" + paramArrayList.size());
      return;
    }
    LogUtils.e(this.TAG, "adapterTe == null");
  }

  public void setDialogSize(float paramFloat1, float paramFloat2, int paramInt)
  {
    int i = CustomApplication.app.displayMetrics.widthPixels;
    int j = CustomApplication.app.displayMetrics.heightPixels;
    ViewGroup.LayoutParams localLayoutParams = this.layout_body.getLayoutParams();
    localLayoutParams.height = ((int)(paramFloat2 * j));
    localLayoutParams.width = i;
    this.layout_body.setLayoutParams(localLayoutParams);
  }

  public void setOnButtonGroupClick(MyDialogListener paramMyDialogListener1, MyDialogListener paramMyDialogListener2)
  {
    this.cancleListener = paramMyDialogListener1;
    this.okListener = paramMyDialogListener2;
  }

  public void setOnButtonGroupClick(String paramString1, MyDialogListener paramMyDialogListener1, String paramString2, MyDialogListener paramMyDialogListener2)
  {
    this.cancleListener = paramMyDialogListener1;
    this.okListener = paramMyDialogListener2;
  }

  public void setOnDefaultButtonClick(MyDialogListener paramMyDialogListener)
  {
    this.defaultListener = paramMyDialogListener;
  }

  public void setOnDefaultButtonClick(String paramString, MyDialogListener paramMyDialogListener)
  {
    this.defaultListener = paramMyDialogListener;
  }

  public void setOnDismissListener(PopupWindow.OnDismissListener paramOnDismissListener)
  {
    super.setOnDismissListener(paramOnDismissListener);
  }

  public void show(View paramView)
  {
    if ((this.result == null) || (this.result.size() == 0))
      getroomRuleInfo();
    this.tv_close = ((TextView)this.view.findViewById(2131100179));
    this.tv_close.requestFocus();
    this.popwindow.setFocusable(true);
    this.popwindow.setOutsideTouchable(true);
    this.popwindow.setBackgroundDrawable(this.context.getResources().getDrawable(2130837536));
    this.popwindow.showAtLocation(paramView, 80, 0, 0);
    this.popwindow.setOnDismissListener(new PopupWindow.OnDismissListener()
    {
      public void onDismiss()
      {
        RequestNet.cancelTag(NewMyOddsPopuWindow.this.context);
        System.out.println("popWindow消失");
      }
    });
    this.sc_peilv_shuoming.smoothScrollTo(0, 0);
  }

  public static abstract interface MyDialogListener
  {
    public abstract void onClick();
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.weight.NewMyOddsPopuWindow
 * JD-Core Version:    0.6.2
 */